/**
 * Title: SearchManager.java
 * Description:
 * Copyright: Copyright (c) 2008
 * Company:深圳彩讯科技有限公司
 * Author 罗旭东 (hi@luoxudong.com)
 * Date 2013-12-24 下午5:07:33
 * Version 1.0
 */
package com.luoxudong.phonenumber.logic.search.manager;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.luoxudong.phonenumber.logic.area.AreaFactory;
import com.luoxudong.phonenumber.logic.area.interfaces.IAreaManager;
import com.luoxudong.phonenumber.logic.db.model.AreaInfo;
import com.luoxudong.phonenumber.logic.db.model.PhoneNumber;
import com.luoxudong.phonenumber.logic.search.interfaces.ISearchManager;
import com.luoxudong.phonenumber.logic.search.vo.SearchCondition;

/** 
 * ClassName: SearchManager
 * Description:TODO(这里用一句话描述这个类的作用)
 * Create by 罗旭东
 * Date 2013-12-24 下午5:07:33
 */
public class SearchManager implements ISearchManager{
	private IAreaManager areaManager = AreaFactory.getAreaManager();
	    
	@Override
	public List<AreaInfo> findAreaInfosByParentAreaId(int parentAreaId) {
		List<AreaInfo> areaInfos = areaManager.getAreaInfoByParentId(parentAreaId);
		AreaInfo areaInfo = new AreaInfo();
		areaInfo.setId(0);
		areaInfo.setParentAreaId(parentAreaId);
		areaInfo.setAreaId(-1);
		areaInfo.setAreaName("不限");
		
		if (areaInfos != null && areaInfos.size() > 0)
		{
			areaInfos.add(0, areaInfo);
		}
		
		return areaInfos;
	}

	@Override
	public int getChildAreaCount(int parentAreaId) {
		return (int)areaManager.getAreaInfoCountByParentId(parentAreaId);
	}

	@Override
	public List<PhoneNumber> getPhoneNumbersFromService(SearchCondition condition, int pageNum, int pageSize) {
		return null;
	}
}
